<template>
  <div id="assetsDetail">
    <div class="homeTitle">债券详情</div>
    <div class="tableBox">
      <div class="table">
        <!-- -------------------------------------------------------- -->
        <div class="tableTitle">申请人信息</div>
        <table>
          <tr>
            <td>机构编号</td> <td>{{user.no}}</td>
            <td>机构名称</td> <td>{{user.bank}}</td>
          </tr>
          <tr>
            <td>操作员工号</td> <td>{{user.jobNum}}</td>
            <td>操作员姓名</td> <td>{{user.name}}</td>
          </tr>
        </table>
        <!-- ------------------------------------------------- -->
        <div class="tableTitle">交易对手：</div>
        <table>
          <tr>
            <td>交易对手</td> <td>{{counterparty.full}}</td>
            <td>交易机构类型</td> <td>{{counterparty.type}}</td>
          </tr>
          <tr>
            <td>业务类型</td> <td>{{account.type}}</td>
            <td>开户行</td> <td>{{account.openBank}}</td>
          </tr>
          <tr>
            <td>账户名称</td> <td>{{account.accountName}}</td>
            <td>账号</td> <td>{{account.number}}</td>
          </tr>
          <tr>
            <td>支付系统行号</td> <td>{{account.payment}}</td>
            <td>托管机构</td> <td>{{account.trusteeship}}</td>
          </tr>
          <tr>
            <td>托管账户名称</td> <td>{{account.trusteeshipAccountName}}</td>
            <td>托管账号</td> <td>{{account.managedAccount}}</td>
          </tr>
        </table>
        <!-- ----------------------------------------------- -->
        <div class="tableTitle">债券信息：</div>
        <table>
          <tr>
            <td>债券代码</td> <td>{{bond.code}}</td>
            <td>债券全称</td> <td>{{bond.name}}</td>
          </tr>
          <tr>
            <td>债券简称</td> <td>{{bond.simple}}</td>
            <td>债券性质</td> <td>{{bond.nature}}</td>
          </tr>
          <tr>
            <td>债券记账品种</td> <td>{{bond.bookVariety}}</td>
            <td>债券币种</td> <td>{{bond.currency}}</td>
          </tr>
          <tr>
            <td>债券面额(元)</td> <td>{{bond.denomination}}</td>
            <td>发行价格(元/百元面值)</td> <td>{{bond.price}}</td>
          </tr>
          <tr>
            <td>计划发行总额(万元)</td> <td>{{bond.planSum}}</td>
            <td>实际发行总额(万元)</td> <td>{{bond.actualSum}}</td>
          </tr>
          <tr>
            <td>还本方式</td> <td>{{bond.repaymentMethod}}</td>
            <td>还本类型</td> <td>{{bond.repaymentType}}</td>
          </tr>
          <tr>
            <td>起息日期</td> <td>{{bond.fromDate | dateformat}}</td>
            <td>债券期限</td> <td>{{bond.maturity}}</td>
          </tr>
          <tr>
            <td>兑付日期</td> <td>{{bond.paymentDate | dateformat}}</td>
            <td>计息基础</td> <td>{{bond.bassisDay}}</td>
          </tr>
          <tr>
            <td>计息方式</td> <td>{{bond.bearingMethod}}</td>
            <td>利率类型</td> <td>{{bond.rateType}}</td>
          </tr>
          <tr>
            <td>票面利率(%)</td> <td>{{bond.couponRate}}</td>
            <td>剩余年限(天)</td> <td>{{$route.query.day}}</td>
          </tr>
          <!-- <tr>
            <td>久期</td> <td></td>
            <td>凸性</td> <td></td>
          </tr> -->
          <tr>
            <td>行权方式</td> <td><el-button type="text" size="small" @click="gohangquan">查看</el-button></td>
            <td></td> <td></td>
          </tr>
        </table>
 <!-- -------------------------------------------------------- -->
        <div class="tableTitle">交易信息：</div>
        <table>
          <tr>
            <td>申请编号</td> <td>{{bondHold.applyNum}}</td>
            <td>申请日期</td> <td>{{bondHold.createTime | dateformat}}</td>
          </tr>
          <tr>
            <td>交易类型</td> <td>{{bondHold.type}}</td>
            <td>交易方向</td> <td>{{bondHold.direction}}</td>
          </tr>
          <tr>
            <td>券面总额（万元）</td> <td>{{bondHold.totalFace}}</td>
            <td>交易日期</td> <td>{{bondHold.transactionDate | dateformat}}</td>
          </tr>
          <tr>
            <td>清算速度</td> <td>{{bondHold.clearSpeed}}</td>
            <td>收益率计算方式</td> <td>{{bondHold.calculatingMethod}}</td>
          </tr>
          <tr>
            <td>结算日期</td> <td>{{bondHold.settlementDate | dateformat}}</td>
            <td>结算方式</td> <td>{{bondHold.settlementMethod}}</td>
          </tr>
          <tr>
            <td>成交编号</td> <td>{{bondHold.transactionNumber}}</td>
            <td>交易金额（元）</td> <td>{{bondHold.sumMoney}}</td>
          </tr>
          <tr>
            <td>净价（元/百元面额）</td> <td>{{bondHold.netWorth}}</td>
            <td>到期收益率（%）</td> <td>{{bondHold.yield}}</td>
          </tr>
          <tr>
            <td>应计利息（元/百元面额）</td> <td>{{bondHold.accruedInterest}}</td>
            <td>应计利息总额（万元）</td> <td>{{bondHold.totalAccruedInterest}}</td>
          </tr>
          <tr>
            <td>结算金额（万元）</td> <td>{{bondHold.settlementMoney}}</td>
            <td></td> <td></td>
          </tr>
        </table>
      </div>
      <div class="btn">
        <el-button type="primary" size="small" @click="close">关闭</el-button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'assetsDetail',
  data () {
    return {
      data: '',
      account: '',
      bond: '',
      bondHold: '',
      counterparty: '',
      power: '',
      user: ''
    };
  },
  created () {
    this.getdata();
  },
  methods: {
    gohangquan() {
      if (this.data.power.length == 0) {
         this.$message({message: '暂无数据',type: 'warning'});
         return false;
      }
      this.$router.push({path: 'assetsDetailHangquan', query: {data: this.data.power}});
    },
    getdata() {
      this.axios.get('bondHold/selectOne', {params: {id: this.$route.query.id}})
        .then(({data})=> {
          this.account = data.data.account;
          this.bond = data.data.bond;
          this.bondHold = data.data.bondHold;
          this.counterparty = data.data.counterparty;
          this.power = data.data.power;
          this.user = data.data.user;
          this.data = data.data;
        })
    },
    close () {
      this.$router.go(-1);
    }
  }
};
</script>

<style lang="scss">
  #assetsDetail {
    .tableBox {
      padding-top: 10;
      color: white;
      .tableTitle {
        line-height: 36px;
        padding-left: 20px;
      }
      table {
        border: 1px solid white;
        width: 100%;
        text-align: center;
        border-collapse:collapse;
        margin-bottom: 20px;
        tr {
          td {
            padding: 5px 10px;
            border-right: 1px solid white;
            border-bottom: 1px solid white;
            &:nth-child(odd) {
              background:#2F3638;
            }
            &:nth-child(even) {
              background: #646E6E;
            }
          }
        }
      }
      .btn {
        text-align: center;
      }
    }
  }
</style>
